

def decorator(func): 
    def wrapper(*args, **kwargs): 
        # *args 表示所有的位置参数，**kwargs 表示所有的关键字参数
        print('123') 
        return func(*args, **kwargs) 
        
    return wrapper 

def say_hello(): 
    print('同学你好') 

# say_hello_super = decorator(say_hello) 
# say_hello_super()

# decorator(say_hello)()


def decorator(func): 
    def wrapper(*args, **kwargs): 
        """doc of wrapper""" 
        print('123') 
        return func(*args, **kwargs) 
        
    return wrapper 
    
@decorator 
def say_hello(): 
    """doc of say hello""" 
    print('同学你好') 

    print(say_hello.__name__) 
    print(say_hello.__doc__)


# say_hello()
# wrapper
# doc of wrapper
# 123
# 同学你好


from functools import wraps 

def decorator(func): 
    @wraps(func) 
    def wrapper(*args, **kwargs): 
        """doc of wrapper""" 
        print('123') 
        return func(*args, **kwargs) 
        
    return wrapper 
    
@decorator 
def say_hello(): 
    """doc of say hello""" 
    print('同学你好') 
    print(say_hello.__name__) 
    print(say_hello.__doc__)


# say_hello()
# 123
# 同学你好
# say_hello
# doc of say hello


class XiaoMing: 
    first_name = '明' 
    last_name = '小' 
    @property 
    def full_name(self): 
        return self.last_name + self.first_name 

xiaoming = XiaoMing() 
print(xiaoming.full_name)



class XiaoMing: 
    @staticmethod 
    def say_hello(): 
        print('同学你好') 

XiaoMing.say_hello() 
# 实例化调用也是同样的效果 
# 有点多此一举 
xiaoming = XiaoMing() xiaoming.say_hello()




